package test
{
	import flash.display.Graphics;
	import flash.display.JointStyle;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.geom.ColorTransform;
	
	public class ClickTest extends Sprite
	{
		public var button1:Sprite; 
		
		public function ClickTest()
		{
			super();
			button1 = createButton();
			button1.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver1);
			button1.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut1);
			button1.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);
			button1.addEventListener(MouseEvent.MOUSE_UP, onMouseUp1);
		}
		
		public function createButton():Sprite {
			var button:Sprite = new Sprite;
			var g:Graphics = button.graphics;
			g.lineStyle(4, 0xE0C290);
			g.beginFill(0xC09761);
//			g.drawRoundRect(0, 0, 80, 40, 20, 20);			
			g.moveTo(0, 40);
			g.lineTo(0, 0);
			g.lineTo(80, 0);
			g.lineTo(80, 40);
			g.lineStyle(4, 0xC09761);
			g.lineTo(0, 40);			
			g.endFill();
			button.x = 100;
			button.y = 100;
			addChild(button);
			return button;
		}
		
		public function onMouseOver1(e:Event):void {
			button1.transform.colorTransform = new ColorTransform(0.85, 0.85, 0.85);			
		}
		
		public function onMouseOut1(e:Event):void {
			button1.transform.colorTransform = new ColorTransform();
		}
		
		public function onMouseDown1(e:Event):void {
			button1.transform.colorTransform = new ColorTransform(0.7, 0.7, 0.7);			
		}
		
		public function onMouseUp1(e:Event):void {
			button1.transform.colorTransform = new ColorTransform(0.85, 0.85, 0.85);			
		}
	}
}